package com.chuxi.demo.jdkproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @ Author:任留辉
 * @ Description:
 * @ Date:Created in 19:33 2021/7/23 0023
 */
public class JdkProxy01 implements InvocationHandler {
    //代理对象
    private Object targetObject01;
    //将目标对象传入进行代理
    public JdkProxy01(Object targetObject01)
    {
        this.targetObject01 = targetObject01;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("前");
        method.invoke(targetObject01, args);
        System.out.println("后");

        return null;
    }
}
